<template>
  <div>
    <h1 style="font-size: 28px">设备报警消息详情</h1>
    <div>
      <a-form :label-col="{ span: 4 }" :wrapper-col="{ span: 14 }">
        <a-form-item label="数据ID">
          <a-input :value="id" disabled/>
        </a-form-item>
        <a-form-item label="消息ID">
          <a-input :value="msg_id" disabled/>
        </a-form-item>
        <a-form-item label="消息类型">
          <a-input :value="type" disabled/>
        </a-form-item>
        <a-form-item label="设备ID">
          <a-input :value="device_id" disabled/>
        </a-form-item>
        <a-form-item label="报警码">
          <a-input :value="warn_code" disabled/>
        </a-form-item>
        <a-form-item label="报警状态">
          <a-input :value="warn_desc" disabled/>
        </a-form-item>
        <a-form-item label="创建人">
          <a-input :value="creator_name" disabled/>
        </a-form-item>
        <a-form-item label="创建时间">
          <a-input :value="create_time" disabled/>
        </a-form-item>
        <a-form-item :wrapper-col="{ span: 14, offset: 4 }">
          <a-button style="width: 140px;" @click="onBack">返回</a-button>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>
<script lang="ts">
import {defineComponent, reactive, toRefs} from "vue";

export default defineComponent({
  name: 'WarnMsgDetail',
  props: {
    item: {
      type: Object,
      default: null,
    },
    viewType: {
      type: String,
      default: null,
    }
  },
  setup(props, {emit}) {
    const data = reactive({
      id: props.item.id,
      msg_id: props.item.msg_id,
      type: props.item.type+'/'+props.item.type.toString(16),
      device_id: props.item.device_id,
      warn_code: props.item.warn_code,
      warn_desc: props.item.warn_desc,
      creator_name: props.item.creator_name,
      create_time: props.item.create_time,
    });

    const onBack = () => {
      emit("my-emit", 'Cancel');
    }

    return {
      ...toRefs(data),
      onBack,
    };
  }

});

</script>

<style scoped>

</style>
